package com.itheima.appserver.service;

import com.itheima.appserver.exception.BusinessException;
import com.itheima.appserver.interceptor.UserHandler;
import com.itheima.dubbo.api.UserLocationApi;
import com.itheima.model.vo.ErrorResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class BaiDuService {

    @DubboReference
    private UserLocationApi userLocationApi;

    public void updatelocation(Double latitude, Double longitude, String addrStr) {
        Boolean aBoolean = userLocationApi.updateLocation(UserHandler.getId(), longitude, latitude, addrStr);
        if (!aBoolean) {
            throw new BusinessException(ErrorResult.error());
        }
    }
}
